/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.test.example.parser;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.logging.Logger;

/**
 *
 * @author Alexx
 */
public abstract class AbstractParser implements Parser {

    private static Logger log = Logger.getLogger(AbstractParser.class.getName());

    public String readFile(String file) {
        BufferedReader br = null;
        StringBuilder sb = new StringBuilder();
        try {
            String sCurrentLine = null;
            br = new BufferedReader(new FileReader(file));
            while ((sCurrentLine = br.readLine()) != null) {
                sb.append(sCurrentLine);
            }
        } catch (IOException e) {
            log.info(e.toString());
        } finally {
            try {
                if (br != null) {
                    br.close();
                }
            } catch (IOException ex) {
                log.info(ex.toString());
            }
        }
        return sb.toString();
    }

    public abstract String parse();
}
